<!doctype html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
</head>
<body>
<!--header start -->
{include file="header"}
<!--header end-->

<!-- <a href="{:url('Mail/email')}">发送邮件</a> -->
<table class="weui-table weui-border-tb" id="cusTable">
    <thead>
    <tr>
        <th  data-field="username" style="border-left:2px solid #fff">活动标题</th>
        <th>活动图片</th>
        <!-- <th>活动内容</th> -->
        <th>活动地点</th>
        <th>活动时间</th>
        <th>活动链接</th>
        <!-- <th>状态</th> -->
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {volist name="data" id="vo"}
        <tr>
            <td data-field="" id="sub" style="border-left:2px solid #fff">{$vo.activity_title}</td>
            <td><img src="/vdma/public/uploads/{$vo.activity_img}" style="width: 50px"></td>
            <!-- <td>{$vo.activity_content}</td> -->
            <td>{$vo.activity_place}</td>
            <th>{$vo.activity_time}</th>
            <th><a href="">{$vo.activity_link}</a></th>
            <!-- <th><a href="###" onclick="change(this)" statusid="{$vo.statuid}" data_id="{$vo.id}"><span >{$vo.statuid == 1?'正常':'失效'}</span></a></th> -->
            <th>
                <a href="{:url('edit',array('id'=>$vo.id))}" id="edit" ><span class="icon icon-115" title="编辑">编辑</span></a>
                <a href="###" id="delete" data-id="{$vo.id}" onclick="del(this)"><span class="icon icon-23"  title="删除">删除</span></a>
            </th>
        </tr>
    {/volist}

    </tbody>
</table>


<div class="pages">{$page}</div>
<!--footer start -->
{include file="footer"}
<!--footer end-->
<script>
    //		删除
    function del(_this){
        var uid = $(_this).attr('data-id');
        $.ajax({
            type:'post',
            url:"{:url('Activity/delete')}",
            data:{'uid':uid},
            success:function(data){

                switch(data){
                    case 1:
                        $(_this).parent().parent().remove();
                        break;
                    case 2:
                        alert('删除失败');
                        break;
                    case 3:
                        alert('用户不存在');
                        break;
                    case 4:
                        alert('请求格式不对');
                        break;
                }
            }
        })
    }


    //修改状态
    function change(_this){
        var statusid = $(_this).attr('statusid');
        var uid = $(_this).attr('data_id');

        $.ajax({
            type:'post',
            url:"{:url('Activity/changestatus')}",
            data:{'statuid':statusid,'id':uid},
            success:function(data){
                if(data.msg == '修改成功'){
//				        console.log(data.statuid);
                    if(data.statuid == 1){
                        var test = $(_this).find('span');
                        var test1 = $(_this).attr('statusid',1);
                        test.text('正常');
                    }else{
                        var test = $(_this).find('span');
                        var test1 = $(_this).attr('statusid',0);
                        test.text('失效');
                    }

                }
            }
        })
    }
</script>
</body>
</html>